package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.MouseBean;
import com.project.dao.IMouseDao;
import com.project.service.IMouseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author RJ
 * @date 2022/9/14 17:11
 */
@Service
@Transactional
public class MouseServiceImpl extends ServiceImpl<IMouseDao, MouseBean> implements IMouseService {
    @Override
    public void addMouse(MouseBean mouseBean) {
        this.save(mouseBean);
    }

    @Override
    public MouseBean getMouseInfo(Integer mouseId) {
        return this.baseMapper.getMouseInfo(mouseId);
    }

    @Override
    public IPage<MouseBean> cutMouseByItem(Integer pageNo, Integer pageSize, String mouseName) {
        Page<MouseBean> page = new Page<>(pageNo, pageSize);
        IPage<MouseBean> iPage = this.baseMapper.cutMouseByItem(page, mouseName);
        return iPage;
    }
}
